#include <complex>
#include <iostream>
using namespace std;
int main() {
  complex<float> z1 = 3.f + 4if;
  cout << "real = " << z1.real() << " image = " << z1.imag() << endl;
  cout << " abs = " << abs(z1) << " angle(rad) = " << arg(z1)
       << " norm = " << norm(z1) << " conj = " << conj(z1)
       << " exp(z1) = " << exp(z1) << " log(z1)" << log(z1)
       << " pow(z1) = " << pow(z1, 3) << " sqrt(z1) = " << sqrt(z1)
       << " sin(z1) = " << sin(z1) << endl;
  const int n = 5;
  complex<double> *p_complex = new complex<double>(n);
  for (int i = 0; i < n; i++) {
    p_complex[i] = static_cast<double>(i + 1) + 0.2i;
  }
  double *p_data = reinterpret_cast<double *>(p_complex);
  for (int i = 0; i < n; i++) {
    cout << "i complex = " << p_complex[i] << endl;
  }
  for (int i = 0; i < n; i++)
    cout << "i real = " << p_data[i] << " imag = " << p_data[i + 1] << endl;
}
